package com.example.demo8;

import javafx.scene.paint.Color;
import java.util.Map;

public class EnemyFactory {
    private static final Map<Integer, EnemyTemplate> TEMPLATES = Map.of(
            0, new EnemyTemplate(Color.RED, 30, 1.5, 5, 120),
            1, new EnemyTemplate(Color.ORANGE, 20, 2, 3, 90),
            2, new EnemyTemplate(Color.PURPLE, 50, 1.0, 8, 150)
    );

    public Enemy createEnemy(double x, double y, int type) {
        EnemyTemplate template = TEMPLATES.get(type);
        return new Enemy(x, y, type, template.color,
                template.maxHealth, template.speed,
                template.damage, template.shootCooldown);
    }

    private static class EnemyTemplate {
        final Color color;
        final int maxHealth;
        final double speed;
        final int damage;
        final int shootCooldown;

        EnemyTemplate(Color color, int maxHealth, double speed,
                      int damage, int shootCooldown) {
            this.color = color;
            this.maxHealth = maxHealth;
            this.speed = speed;
            this.damage = damage;
            this.shootCooldown = shootCooldown;
        }
    }
}